﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Code.BLL;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Code.Models;

namespace QianBuo.Lottery.Web.Areas.Manage.Models
{
    [Serializable]
    public class ChaseTaskModels
    {
        [Serializable]
        public class IndexModel
        {
            public IndexModel()
            {
                Serch = new ChaseManage.ChaseTaskSerchModel();
                var selectitems = CacheManage.Lottery.Where(p => p.Value.State != (short)LotteryState.Locked).OrderBy(p=>p.Value.ID).OrderBy(p=>p.Value.Sort)
                    .Select(p => new SelectListItem { Text = p.Value.Name, Value = p.Key.ToString() }).ToList();
                selectitems.Insert(0, new SelectListItem { Text = "所有彩种", Value = string.Empty });
                Lotterys = selectitems;
                selectitems = CacheManage.Ratio.Where(p => p.Value.State != (short)ConsumeRatioState.Locked)
                    .Select(p => new SelectListItem { Text = p.Value.Name, Value = ((double)p.Value.Ratio).ToString() }).ToList();
                selectitems.Insert(0, new SelectListItem { Text = "所有", Value = string.Empty });
                Ratios = selectitems;
                selectitems = CacheManage.WinModel.Where(p => p.Value.State != (short)WinMoneyModelState.Locked)
                    .Select(p => new SelectListItem { Text = p.Value.Name, Value = p.Value.ID.ToString() }).ToList();
                selectitems.Insert(0, new SelectListItem { Text = "所有", Value = string.Empty });
                WinModels = selectitems;
                selectitems = (Enum.GetValues(typeof(ChaseTaskState)) as ChaseTaskState[]).Select(p => new SelectListItem { Text = p.GetName(), Value = p.ToString() }).ToList();
                selectitems.Insert(0, new SelectListItem { Text = "所有", Value = string.Empty });
                States = selectitems;
                StopWins = new SelectListItem[] { new SelectListItem { Text = "所有", Value = string.Empty }, new SelectListItem { Text = "是", Value = "0" }, new SelectListItem { Text = "否", Value = "-1" } };
                
            }
            [Required]
            public ChaseManage.ChaseTaskSerchModel Serch { get; set; }
            public IEnumerable<ChaseManage.ChaseTaskItem> Tasks { get; set; }
            public ChaseManage.ChaseTaskItem SumTask { get; set; }
            public IEnumerable<SelectListItem> Lotterys { get; set; }
            public IEnumerable<SelectListItem> States { get; set; }
            public IEnumerable<SelectListItem> WinModels { get; set; }
            public IEnumerable<SelectListItem> Ratios { get; set; }
            public IEnumerable<SelectListItem> StopWins { get; set; }
            public int Page { get; set; }
            public int PageSize { get; set; }
            public int SumCount { get; set; }
        }

        [Serializable]
        public class DetailModel
        {
            public int Page { get; set; }
            public int PageSize { get; set; }
            public int SumCount { get; set; }
            public ChaseManage.ChaseTaskItem Task { get; set; }
            public ChaseManage.ChaseTaskDetailItem SumDetail { get; set; }
            public IEnumerable<ChaseManage.ChaseTaskDetailItem> Details { get; set; }
            public IEnumerable<ChaseManage.ChaseTaskNumberItem> Numbers { get; set; }
        }

    }
}